import 'package:fluro_test/config/NavigatorUtil.dart';
import 'package:flutter/material.dart';
import 'package:rxdart/rxdart.dart';

class SplashPage extends StatefulWidget {
  @override
  _SplashPageState createState() => _SplashPageState();
}

class _SplashPageState extends State<SplashPage> {
  @override
  void initState() {
    // Future.delayed(Duration(seconds: 5), () {
    //   NavigatorUtil.goHomePage(context);
    // });

    /// 2秒后跳转到主页面，上面注释的代码也可以做到倒计时
    Observable.timer(0, Duration(seconds: 3)).listen((_) {
      /// 然后看 NavigatorUtil.dart
      NavigatorUtil.goHomePage(context);
    });
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return Container(
      child: Image.asset('assets/images/splash.jpg', fit: BoxFit.fill),
    );
  }
}
